home *** CD-ROM | disk | FTP | other *** search
/ Info-Mac 4 / Info_Mac IV CD-ROM (Pacific HiTech Inc.)(August 1994).iso / Development / Source / stuff / stuff.h < prev    next >
Text File  |  1994-05-03  |  3KB  |  122 lines

  1. /* stuff.h: contains declarations for SIT headers */
  2.  
  3. #include <string.h>
  4.  
  5. #include <Files.h>
  6. #include <AppleEvents.h>
  7. #include <Quickdraw.h>
  8. #include <Menus.h>
  9. #include <Windows.h>
  10. #include <ToolUtils.h>
  11. #include <Desk.h>
  12. #include <SegLoad.h>
  13. #include <OSUtils.h>
  14. #include <Memory.h>
  15. #include <Fonts.h>
  16. #include <Events.h>
  17. #include <OSEvents.h>
  18. #include <TextEdit.h>
  19. #include <Dialogs.h>
  20. #include <Aliases.h>
  21. #include <Folders.h>
  22. #include <Errors.h>
  23.  
  24. typedef unsigned char u_char;
  25. typedef unsigned short u_short;
  26. typedef unsigned int u_int;
  27. typedef unsigned long u_long;
  28. typedef unsigned short ushort;
  29.  
  30. typedef struct sitHdr {        /* 22 bytes */
  31.     u_char    sig1[4];        /* = 'SIT!' -- for verification */
  32.     u_char    numFiles[2];    /* number of files in archive */
  33.     u_char    arcLen[4];        /* length of entire archive incl. */
  34.     u_char    sig2[4];        /* = 'rLau' -- for verification */
  35.     u_char    version;        /* version number */
  36.     char reserved[7];
  37. };
  38.  
  39. typedef struct fileHdr {    /* 112 bytes */
  40.     u_char    compRMethod;        /* rsrc fork compression method */
  41.     u_char    compDMethod;        /* data fork compression method */
  42.     u_char    fName[64];            /* a STR63 */
  43.     char    fType[4];            /* file type */
  44.     char    fCreator[4];        /* creator... */
  45.     char    FndrFlags[2];        /* copy of Finder flags */
  46.     char    cDate[4];            /* creation date */
  47.     char    mDate[4];            /* !restored-compat w/backup prgms */
  48.     u_char    rLen[4];            /* decom rsrc length */
  49.     u_char    dLen[4];            /* decomp data length */
  50.     u_char    cRLen[4];            /* compressed lengths */
  51.     u_char    cDLen[4];
  52.     u_char    rsrcCRC[2];            /* crc of rsrc fork */
  53.     u_char    dataCRC[2];            /* crc of data fork */
  54.     char    reserved[6];
  55.     u_char    hdrCRC[2];            /* crc of file header */
  56. };
  57.  
  58. /* file format is:
  59.     sitArchiveHdr
  60.         file1Hdr
  61.             file1RsrcFork
  62.             file1DataFork
  63.         file2Hdr
  64.             file2RsrcFork
  65.             file2DataFork
  66.         .
  67.         .
  68.         .
  69.         fileNHdr
  70.             fileNRsrcFork
  71.             fileNDataFork
  72. */
  73.  
  74.  
  75.  
  76. /* compression methods */
  77. #define noComp    0    /* just read each byte and write it to archive */
  78. #define repComp 1    /* RLE compression */
  79. #define lpzComp 2    /* LZW compression */
  80. #define hufComp 3    /* Huffman compression */
  81.  
  82. /* all other numbers are reserved */
  83.  
  84.  
  85. /* comp14.c */
  86. void compress(int, int);
  87. void copy(int, int);
  88. extern long prog_div;
  89. void    UpdateProgress(long progress);
  90. extern unsigned short crc;
  91. unsigned short updcrc(unsigned short icrc, unsigned char *icp, int icnt);
  92.  
  93. /* progress.c */
  94. OSErr GotRequiredParams(AppleEvent *);
  95. pascal OSErr HandleOapp(AppleEvent *, AppleEvent *, long);
  96. void scanfolder(FSSpec *);
  97. pascal OSErr HandleOdoc(AppleEvent *, AppleEvent *, long);
  98. pascal OSErr HandlePdoc(AppleEvent *, AppleEvent *, long);
  99. pascal OSErr HandleQuit(AppleEvent *, AppleEvent *, long);
  100. pascal OSErr ReturnEventNotHandled(AppleEvent *, AppleEvent *, long);
  101. void main(void);
  102. void SetUpMenus(void);
  103. void AdjustMenus(void);
  104. void HandleMenu(long);
  105. void SetUpWindow(void);
  106. void InitMacintosh(void);
  107. void HandleMouseDown(EventRecord *);
  108. void HandleEvent(void);
  109. void    UpdateProgress(long);
  110. void    UpdateFileName(FSSpec *name);
  111. void BeginProcessing(void);
  112. void EndProcessing(int numDocs);
  113. void ProcessDoc (FSSpec *curDocFSS, char mode);
  114. void HandleMenu (long mSelect);
  115. void SetUpMenus(void);
  116. void InitMacintosh(void);
  117. void HandleMouseDown (EventRecord *theEvent);
  118. void HandleEvent(void);
  119. void Drawprogress (short active);
  120. void SetUpWindow(void);
  121. void ChkOsErr(OSErr);
  122.